<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="Content-Script-Type" content="text/javascript" />
		<meta http-equiv="Content-Style-Type" content="text/css" />
		<title>コントロールパネル</title>
		<link rel="stylesheet" href="./assets/styles/default.css" type="text/css" />
		<link rel="stylesheet" href="./assets/styles/ui-lightness/ui.all.css" type="text/css" />
		
		<link rel="stylesheet" href="./assets/styles/ui-lightness/jquery-ui-1.7.3.custom.css" type="text/css" />
		<link rel="stylesheet" href="./assets/styles/dialog.css" type="text/css" />
		
		<script src="assets/scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
		<script src="assets/scripts/jquery-ui-1.7.3.custom.min.js" type="text/javascript"></script>
		<script src="assets/scripts/ui/ui.dialog.js" type="text/javascript"></script>
		
		
		<script src="assets/scripts/menu.js" type="text/javascript"></script>
		<script src="assets/scripts/table.js" type="text/javascript"></script>
		<script type="text/javascript" src="./tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
		
		<script type="text/javascript" src="./assets/scripts/editor.js"></script>
		<script type="text/javascript" src="./assets/scripts/ui/ui.datepicker.js"></script>
		<script type="text/javascript" src="./assets/scripts/ui/ui.core.js"></script>
		<script type="text/javascript">
		$(function() {
			$('.message').fadeIn("slow");
			$('.btn_regist').click(function(){
				if( confirm('登録してよろしいですか？') ){
					document.fm.mode.value = 'input';
					document.fm.submit();
				}
			});
			
			$('.btn_update').click(function(){
				if( confirm('更新してよろしいですか？') ){
					document.fm.mode.value = 'input';
					document.fm.submit();
				}
			});
			$('.btn_return').click(function(){
				location.href = "mcost_tvsp_index.php?hist=2";
			});
			
			$('.text_date').datepicker({
				changeMonth: true,
				changeYear: true,
				dateFormat: 'yy/mm/dd'
			});
			
			$('#year4').change(function(){
				var year4 = this.value;
				var myDate = new Date();
				var nowtime =  myDate.getTime();
					
				$.get("mmap_week_ajax.php",{ y: year4,t : nowtime }, function(data){
					$("#matrix_cd").children().remove();
					$("#matrix_cd").append( data ); 
				});
			});
			$('#electric_id').change(function(){
				var val = this.value;
				var myDate = new Date();
				var nowtime =  myDate.getTime();
				var year4 = $('#year4').attr("value");
				
				$.get("ajax_cost_tvsp_mater.php",{  e: val,y:year4,t : nowtime  }, function(data){
					$("#mater_id").children().remove();
					$("#mater_id").append( data ); 
				});
			});
			
		});
		


		</script>
		
	</head>
	<body id="">
{{ $menu }}
{{ $logout }}
		<div id="container"><div class="wrapper">
			<h2>TVSP経費マスター管理</h2>
			<ul class="submenu clearfix">
				<li><a href="mcost_tvsp_index.php">一覧.更新</a></li>
				<li>経費入力</li>
				<li><a href="mcost_tvsp_export.php">経費出力</a></li>
				<li><a href="mcost_tvsp_import.php">経費一括登録</a></li>
				<li><a href="mcost_tvsp_electric.php">電波圏マスタ</a></li>
				{{if $login.staff_auth != 'G-9'}}<li><a href="mcost_tvsp_mater.php">素材マスタ</a></li>{{/if}}
				<li><a href="mcost_tvsp_matter_export.php">素材出力</a></li>
			</ul>
			<h3>TVSP経費情報{{ if $forms.id == '' }}登録{{ else }}更新{{ /if }}{{ if $phase == 'complete' }}完了{{ /if }}</h3>
{{ if $phase == 'input' }}
			<p class="message">内容を確認し、{{ if $forms.id == '' }}登録{{ else }}更新{{ /if }}ボタンをクリックしてください。</p>
			<form name="fm" action="mcost_tvsp_form.php" method="post">
				<table class="formTable">
					<tbody>
{{ if $forms.id != '' }}
						<tr>
							<th>更新日</th>
							<td>
								{{ $forms.u_time|date_format:"%Y/%m/%d %H:%M" }}<input type="hidden" name="u_time" value="{{ $forms.u_time }}" />
							</td>
						</tr>
						<tr>
							<th>更新者</th>
							<td>
								{{ $forms.m_user_name }}<input type="hidden" name="m_user_name" value="{{ $forms.m_user_name }}" />
							</td>
						</tr>
						<tr>
							<th>ID</th>
							<td>
								{{ $forms.id }}
							</td>
						</tr>
{{ /if }}
						<tr>
							<th>※電波圏</th>
							<td>
								{{ html_options id='electric_id' name='electric_id'  options=$electrics selected=$forms.electric_id }}{{ $err.electric_id }}
								<input type="hidden" name="electric_name" value="{{ $forms.electric_name }}" />
							</td>
						</tr><tr>
							<th>※素材名</th>
							<td>
								{{ html_options id='mater_id' name='mater_id'  options=$maters selected=$forms.mater_id }}{{ $err.mater_id }}
							</td>
						</tr><tr>
							<th>※週</th>
							<td>
	{{ html_options id='year4' name='year4' options=$year4 selected=$forms.year4 }}年{{ html_options id='matrix_cd' name='matrix_cd' options=$week  selected=$forms.matrix_cd }}週{{ $err.matrix_cd }}
							</td>
						</tr><tr>
							<th>※放映日付</th>
							<td>
								<input type="text" name="tele_date_start" class="text_date" value="{{ $forms.tele_date_start }}"  />{{ $err.tele_date_start }}
								 ～ 
								<input type="text" name="tele_date_end" class="text_date" value="{{ $forms.tele_date_end }}"  />{{ $err.tele_date_end }}
							</td>
						</tr><tr><th>※GRP</th>
							<td>
								<input type="text" name="grp" class="text" value="{{ $forms.grp|escape }}"  maxlangth="100" />{{ $err.grp }}
							</td>
						</tr><tr>
							<th>※経費</th>
							<td>
								<input type="text" name="cosrt" class="text" value="{{ $forms.cosrt|escape }}"  maxlangth="100" />{{ $err.cosrt }}
							</td>
						</tr>
						
					</tbody>
				</table>
				<p class="button">
{{ if $forms.id != '' }}
					<button type="button" class="btn_return" class="submit"><span>戻る</span></button>
					<button type="button" class="btn_update" class="submit"><span>更新</span></button>
{{ else }}
					<button type="button" class="btn_regist" class="submit"><span>登録</span></button>
{{ /if }}
				</p>
				<input type="hidden" name="id" value="{{ $forms.id }}" />
				<input type="hidden" name="mode" value="" />
			</form>

<div id="dialog" >
</div>
 
{{ /if }}

{{ if $phase == 'complete' }}
			<p class="message">{{ $message }}</p>
			<ul>
{{ if $forms.id != '' }}
				<li>>> <a href="mcost_tvsp_index.php?hist=2">一覧ページに戻る</a></li>
{{ else }}
				<li>>> <a href="mcost_tvsp_index.php">一覧ページに戻る</a></li>
{{ /if }}
				<li>>> <a href="mcost_tvsp_form.php">新規登録</a></li>
{{ if $forms.id != '' }}
				<li>>> <a href="mcost_tvsp_form.php?id={{ $forms.id }}">更新</a></li>
{{ /if }}
			</ul>
{{ /if }}

		</div></div>
		{{ $footer }}
	</body>
</html>